<?php

namespace frontend\modules\shop\controllers;

use Yii;
use frontend\components\Controller;

/**
 * 购物车
 * 
 * @author emhome<emhome@163.com>
 * @since 2.0
 */
class SkuController extends Controller {

    /**
     * actionView
     * 
     * @view view.php
     * @return mixed
     */
    public function actionView($id) {

        $sku = [
            'tree' => [
                [
                    'k' => '颜色',
                    'k_id' => '1',
                    'v' => [
                        [
                            'id' => '30349',
                            'name' => '天蓝色',
                            'imgUrl' =>
                            'https://img.yzcdn.cn/upload_files/2017/02/21/FjKTOxjVgnUuPmHJRdunvYky9OHP.jpg!100x100.jpg'
                        ]
                    ],
                    'k_s' => 's1',
                    'count' => 2
                ],
                [
                    'k' => '尺码',
                    'k_id' => '2',
                    'v' => [
                        [
                            'id' => '1193',
                            'name' => 'S'
                        ],
                        [
                            'id' => '1194',
                            'name' => 'M'
                        ],
                        [
                            'id' => '1195',
                            'name' => 'L'
                        ],
                        [
                            'id' => '1196',
                            'name' => 'XL'
                        ],
                        [
                            'id' => '1197',
                            'name' => 'XXL'
                        ]
                    ],
                    'k_s' => 's2',
                    'count' => 2
                ]
            ],
            'list' => [
                [
                    'id' => 2259,
                    'price' => 100,
                    'discount' => 100,
                    'code' => '',
                    's1' => '1215',
                    's2' => '1193',
                    's3' => '0',
                    's4' => '0',
                    's5' => '0',
                    'extend' => null,
                    'kdt_id' => 55,
                    'discount_price' => 0,
                    'stock_num' => 110,
                    'stock_mode' => 0,
                    'is_sell' => null,
                    'combin_sku' => false,
                    'goods_id' => 946755
                ],
                [
                    'id' => 2260,
                    'price' => 100,
                    'discount' => 100,
                    'code' => '',
                    's1' => '1215',
                    's2' => '1194',
                    's3' => '0',
                    's4' => '0',
                    's5' => '0',
                    'extend' => null,
                    'kdt_id' => 55,
                    'discount_price' => 0,
                    'stock_num' => 0,
                    'stock_mode' => 0,
                    'is_sell' => null,
                    'combin_sku' => false,
                    'goods_id' => 946755
                ],
                [
                    'id' => 2257,
                    'price' => 100,
                    'discount' => 100,
                    'code' => '',
                    's1' => '30349',
                    's2' => '1193',
                    's3' => '0',
                    's4' => '0',
                    's5' => '0',
                    'extend' => null,
                    'kdt_id' => 55,
                    'discount_price' => 0,
                    'stock_num' => 111,
                    'stock_mode' => 0,
                    'is_sell' => null,
                    'combin_sku' => false,
                    'goods_id' => 946755
                ],
                [
                    'id' => 2258,
                    'price' => 100,
                    'discount' => 2,
                    'code' => '',
                    's1' => '30349',
                    's2' => '1194',
                    's3' => '0',
                    's4' => '0',
                    's5' => '0',
                    'extend' => null,
                    'kdt_id' => 55,
                    'discount_price' => 0,
                    'stock_num' => 6,
                    'stock_mode' => 0,
                    'is_sell' => null,
                    'combin_sku' => false,
                    'goods_id' => 946755
                ]
            ],
            'price' => rand(100, 600),
            'stock_num' => 227,
            'collection_id' => 2261,
            'collection_price' => 0,
            'none_sku' => false,
            'sold_num' => 0,
            'min_price' => '1.00',
            'max_price' => '1.00',
            'hide_stock' => false
        ];
        return [
            'kdt_id' => 55,
            'user_id' => 4674509,
            'offline_id' => 0,
            'activity_alias' => '',
            'sku' => $sku,
            'goods_id' => '946755',
            'alias' => '2oml0r0n5vytj',
            'quota' => 0,
            'is_virtual' => '0',
            'quota_used' => 0,
            'goods_info' => [
                'title' => '测试商品' . $id,
                'picture' => 'https://img.yzcdn.cn/upload_files/2017/03/16/Fs_OMbSFPa183sBwvG_94llUYiLa.jpeg?imageView2/2/w/100/h/100/q/75/format/jpg',
                'price' => rand(100, 600),
                'origin' => ''
            ]
        ];
    }

}
